#include "Camera.h"

Camera::Camera(int cameraIndex) : m_cameraIndex(cameraIndex) {}

Camera::~Camera() {
    close();
}

bool Camera::open() {
    return m_capture.open(m_cameraIndex);
}

bool Camera::isOpen() const {
    return m_capture.isOpened();
}

bool Camera::captureFrame(cv::Mat& frame) {
    if (isOpen()) {
        return m_capture.read(frame);
    }
    return false;
}
bool Camera::getFrame(cv::Mat& frame) {
    if (isOpen()) {
        return m_capture.read(frame);
    }
    return false;
}


void Camera::close() {
    if (isOpen()) {
        m_capture.release();
    }
}